package com.net.xpay.web.controller.merchant.auto;


import com.google.common.base.Preconditions;
import com.net.common.model.ResultPagedList;
import com.net.xpay.common.domain.User;
import com.net.xpay.core.domain.auto.AutoPayTransBatch;
import com.net.xpay.core.manager.auto.AutoPayTransBatchManager;
import com.net.xpay.core.model.AutoPayTransBatchSearchModel;
import com.net.xpay.web.secutiry.RequestUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/merchant/auto-pay-trans-batch")
@Api(tags = "商户/自动付转账记录", description = "商户 自动付转账记录 net")
public class AutoPayTransBatchController {




    @Autowired
    private AutoPayTransBatchManager autoPayTransBatchManager;




    /**
     * 搜索
     */
    @ApiOperation("搜索")
    @PostMapping("/search")
    public ResultPagedList<AutoPayTransBatch> searchAutoPayBath(@ApiIgnore @RequestUser User merchant, @RequestBody AutoPayTransBatchSearchModel searchModel) {
        Preconditions.checkArgument(searchModel != null);
        searchModel.setUserId(merchant.getId());
        List<AutoPayTransBatch> records = autoPayTransBatchManager.search(searchModel);
        long count = autoPayTransBatchManager.searchCount(searchModel);
        return new ResultPagedList<AutoPayTransBatch>(records, count, searchModel);
    }
    }



